package com.jiyun.controller;

import com.jiyun.entity.day06.Paper;
import com.jiyun.feign.PaperFeign;
import com.jiyun.vo.ResponseBean;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("paper")
public class PaperController {
@Resource
private PaperFeign paperFeign;

    /**
     * 根据竞赛id查询所有试卷
     * @param contestId
     * @return
     */
    @RequestMapping("findPaperByContestId")
    public ResponseBean findPaperByContest(@RequestParam Integer contestId){
        return paperFeign.findPaperByContest(contestId);
    }
    /**
     * 遍历
     * @param paper
     * @return
     */
    @RequestMapping("findByAll")
    public ResponseBean findByAll(@RequestBody Paper paper){
        return paperFeign.findByAll(paper);
    }

    /**
     * 查询最热的数据
     * @return
     */
    @RequestMapping("findByUserMax")
    public ResponseBean findByUserMax(){
        return paperFeign.findByUserMax();
    }

    /**
     * 查询最新的数据
     * @return
     */
    @RequestMapping("findNewTime")
    public ResponseBean findNewTime(){
        return paperFeign.findNewTime();
    }
}
